<?php
//Authenticate a user
function authenticated($parameters){

	//Global stall requires no user name or password
	if($parameters -> {'stallName'} == 'Global'){
		$authenticated = true;
	}
	else{
		//Query for stall number where stall name and password are correct
		$stallQuery = mysql_query("select Stalls.stall from tftpot_tftp.Stalls where Stalls.name = '".$parameters -> {'stallName'}."' and Stalls.password = '".$parameters -> {'stallPassword'}."'");
		//If a row is affected they are authenticated and cookie is set
		if(mysql_affected_rows() == 1)
		{
			$authenticated = true;
		}
		else{
			$authenticated = false;
			$error = 'Stall or Password incorrect';
		}

	}
	return $authenticated;
}
?>